#ifndef __H_SB_CONSTANT_H_
#define __H_SB_CONSTANT_H_

#define SB_MAX_WORKERS_NUM      50

#define SB_SYS_CMD_QUICKEXIT                    1
#define SB_SYS_CMD_SLOWEXIT                     2
#define SB_SYS_CMD_RELOAD_CONFIG		3	/* no use for worker process */
#define SB_SYS_CMD_SHOW_STATUS			4

#define SYS_CONFIG_PATHFILE_NAME	256
#define IP_STR_LEN 			64

#define BALANCE_MODE_RR			"rr"
#define BALANCE_MODE_RANDOM		"random"
#define BALANCE_MODE_WEIGHT		"weight"
#define BALANCE_MODE_IPHASH		"iphash"	
#define CONF_LISTEN_NUM_PERRULE         5
#define CONF_CLIENT_NUM_PERRULE         50
#define CONF_SERVER_NUM_PERRULE         50
#define CONF_RULE_NAME_MAX_LEN          50
#define CONF_RULE_MAX_NUMS              25
#define CONF_INT_ANY                    -255
#define CONF_STR_ANY                    "any"

#define CONNECT_TYPE_CLIENT		1
#define CONNECT_TYPE_SERVER		2
#define EVENT_TYPE_LISTEN		1
#define EVENT_TYPE_SOCKET		2
#define EVENT_TYPE_FILEFD		3

#define MAXIOBUFLEN     		(4096 << 1)
#define MAXIOBUFLEN_2     		(4096 << 2 )
#define MAXCANUSEBUFLEN 		12288           /* (MAXIOBUFLEN * 3 / 4) */
#define MAXSAFEBUFLEN   		4096            /* (MAXIOBUFLEN * 1 / 4) */
#define EMPTY_EVENT_DELAY_TIME		500    	/*ms*/

#define FINISH_REASON_SUCESS_TRANSFER		0
#define FINISH_REASON_CLIENTNOTALLOW		1
#define FINISH_REASON_PROCESSEVENTERR		2
#define FINISH_REASON_TIMEOUT			3
#define FINISH_REASON_RESOURCENOTENOUGH		4
#define FINISH_REASON_CLIENTREADERR		5
#define FINISH_REASON_CLIENTWRITEERR		6
#define FINISH_REASON_SERVERREADERR		7
#define FINISH_REASON_SERVERWRITEERR		8
#define FINISH_REASON_CONNECTSERVERERR		9
#define FINISH_REASON_SYSTEMCALLERR		10
#define FINISH_REASON_INTERNALERR		11
#define FINISH_REASON_CANNOTGETSERVER		11

#define SYS_MAX_LISTEN_NUM			50	
#define SYS_RECOURCE_POOR_ACCEPT_DELAY		1000	/* ms */

#define SB_OK		0
#define SB_ERROR	-1
#define SB_AGAIN	-2
#define SB_DONE		-3
#define SB_DECLINE	-4
#define SB_BUFNOTENOUGH	-5
#define SB_TIMEOUT	-6
#define SB_CONNECTERR	-7
#define SB_NOTFOUND	-8

#define SB_MSG_QUEUE_MAX_MSG_LEN	512
#define SB_NO_WAIT			1


/* dns */
#define SB_DNS_MAX_HOSTNAME_LEN		256

#endif
